package com.wn.consumer.controller;

import com.netflix.hystrix.contrib.javanica.annotation.DefaultProperties;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.wn.api.UserApi;
import com.wn.bean.User;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author yellow Docter
 * @date 2023 -08-07
 * @desc
 */
@RestController
@RequestMapping("/user2")
public class User2Controller {

    @Autowired
    private UserApi userApi;

    @ApiOperation("测试Hystrix服务降级2、openfeign接口实现的回调")
    @GetMapping("get/{id}")
    public User getUserById(@PathVariable("id") Integer id){
        return userApi.findUserById(id);
    }

}
